<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">
  <title>用户登录-{:seo('title')}</title>
  <link href="/static/user/login/css/sb-admin-2.min.css" rel="stylesheet">
  <link rel="stylesheet" href="/static/hqui/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="/static/hqui/module/admin.css">
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        .login-captcha {
        height: 38px;
        width: 140px;
        cursor: pointer;
        box-sizing: border-box;
        border: 1px solid #e6e6e6;
        border-radius: 2px !important;
        position: absolute;
        right: 60px;
    }
        </style>
</head>
<body style="background-color:#b8cbd7 ;background-repeat: no-repeat;background-size: cover;min-height: 100vh;background-position: center 0;">
    <div class="container" style="margin-top:120px;">
        <!-- Outer Row -->
        <div class="row justify-content-center">
            <div class="col-xl-10 col-lg-12 col-md-9">
                <div class="card o-hidden border-0 shadow-lg my-5">
                    <div class="card-body p-0">
                        <!-- Nested Row within Card Body -->
                        <div class="row">
                            <div class="col-lg-6 d-none d-lg-block bg-login-image"></div>
                            <div class="col-lg-6">
                                <div class="p-5">
                                    <div class="text-center">
                                        <h1 class="h4 text-gray-900 mb-4"><img src="/static/img/login/logo.png" width="100%"></h1>
                                    </div>
                                    <form id="login_form" class="layui-form" action="{:url('store/index/login')}" method="post">
                                        <div class="form-group">
                                            <input class="form-control form-control-user" name="username" id="username" placeholder="请输入用户名/手机号" autocomplete="off" lay-verType="tips" lay-verify="required" required/>
                                        </div>
                                        <div class="form-group">
                                            <input class="form-control form-control-user" name="password" id="password" placeholder="请输入登录密码" type="password"
                   lay-verType="tips" lay-verify="required" required/>
                                        </div>
                                        {if sys_set('is_captcha')=='1'}
                                        <div class="form-group">
                                            <img src="{:url('store/index/captcha')}" onclick="this.src='{:url('store/index/captcha')}?rand='+Math.random()" class="login-captcha" />
                                            <input class="form-control form-control-user" name="captcha" placeholder="请输入验证码" autocomplete="off"
                   lay-verType="tips" lay-verify="required" required/>
                                            
                                        </div>
                                        {/if}
                                        <div class="form-group">
                                            <div class="custom-control custom-checkbox small">
                                                <input type="checkbox" class="custom-control-input"  name="remember_user" id="remember_user" title="记住密码" lay-skin="primary" checked>
                                            </div>
                                        </div>
                                        <font color="red"></font>
                                        <button class="btn btn-success layui-btn-normal btn-user btn-block" lay-filter="login" lay-submit>登录</button>
                                        <hr>
                                    </form>
                                    <hr>
                                    <div class="text-center">
                                        <div class="login-copyright">{:seo('copyright')}<br><a href="http://beian.miit.gov.cn">{:seo('beian')}</a></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- js部分 -->
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/static/hqui/libs/layui/layui.js"></script>
<script type="text/javascript" src="/static/hqui/js/common.js"></script>
<script>
    layui.use(['layer', 'form', 'jquery'], function(){
        var layer = layui.layer,
            form  = layui.form,
            $     = layui.jquery;

        form.on('submit(login)', function(data) {
            var index = layer.msg('登录中，请稍候', {
                icon: 16,
                time: false,
                shade: 0.3
            });
            if ($("#remember_user").prop("checked") == true) {
                    var user_name = $("#username").val();
                    var user_password = $("#password").val();
                    $.cookie("remember_user", "true", {
                            expires: 700
                    }); // 存储一个带7天期限的 cookie
                    $.cookie("user_name", user_name, {
                            expires: 700
                    }); // 存储一个带7天期限的 cookie
                    $.cookie("user_password", user_password, {
                            expires: 700
                    }); // 存储一个带7天期限的 cookie
            } else {
                    $.cookie("remember_user", "false", {
                            expires: -1
                    }); // 删除 cookie
                    $.cookie("user_name", '', {
                            expires: -1
                    });
                    $.cookie("user_password", '', {
                            expires: -1
                    });
            }
            $.ajax({
                url: data.form.action,
                type: data.form.method,
                dataType: 'json',
                data: $(data.form).serialize(),
                success: function(result) {
                    if (result.code === 1) {
                        location.href = result.url;
                    } else {
                        $('.captcha img').attr('src', '{:url("store/index/captcha")}?rand='+Math.random());
                        layer.close(index);
                        layer.msg(result.msg);
                    }
                },
                error: function (xhr, state, errorThrown) {
                    layer.close(index);
                    layer.msg(state + '：' + errorThrown);
                }
            });

            return false;
        });
        //

    });

</script>
<script>
    $(function() {
        if ($.cookie("remember_user")) {
                $("#remember_user").prop("checked", true);
                $("#username").val($.cookie("user_name"));
                $("#password").val($.cookie("user_password"));
                // 输入框内容变化按钮颜色发生变化
                $(".form-data input").siblings("label").hide();
                $(".log-btn").removeClass("off")
        }
});

function saveUserInfo() {

}
</script>
</body>
</html>


